home *** CD-ROM | disk | FTP | other *** search
- #ifndef __ICAPI__
- #include <ICAPI.h>
- #endif
-
- #include "UtilsSys7.h"
- #include "FabLibResIDs.h"
- #include "Internet.h"
-
- static ICError MyICLaunchURL(ICInstance inst, short STRid);
-
- #pragma segment Main
-
- void InternetLaunch(ICInstance inst, ICError *icErr, ModalFilterProcPtr filterProc, AEIdleProcPtr IdleFunct, short urlWanted)
- {
- Str31 errorStr;
- ICError locICErr;
-
- if (inst) {
- *icErr = MyICLaunchURL(inst, urlWanted);
- UnloadSeg(MyICLaunchURL);
- }
- locICErr = *icErr;
- if (locICErr) {
- switch (locICErr) {
- case icPrefNotFoundErr:
- (void)StopAlert_AE(kALRT_ICMISSINGHELPER, filterProc, IdleFunct);
- break;
- default:
- NumToString(locICErr, errorStr);
- ParamText(errorStr, nil, nil, nil);
- (void)StopAlert_AE(kALRT_INTERNETCONFIG, filterProc, IdleFunct);
- }
- }
- }
-
- #pragma segment Internet
-
- ICError MyICLaunchURL(ICInstance inst, short STRid)
- {
- StringHandle theString;
- long selStart, selEnd;
- const short nullstr = 0; // otherwise IC 1.1 will crash (doesn't like odd-aligned strings)
- ICError err;
-
- if (theString = GetString(STRid)) {
- selStart = 0L;
- selEnd = **theString;
- HLockHi((Handle) theString);
- err = ICLaunchURL(inst, (ConstStr255Param)&nullstr, (Ptr)*theString + 1, selEnd, &selStart, &selEnd);
- HUnlock((Handle) theString);
- // UnloadSeg(ICLaunchURL);
- }
- else
- err = ResError();
-
- return err;
- }
-
- #pragma segment Init
-
- ICError MyICInit(ICInstance *inst, OSType creator)
- {
- ICError err;
-
- if (err = ICStart(inst, creator))
- *inst = nil;
- else
- err = ICFindConfigFile(*inst, 0, nil);
- UnloadSeg(ICStart);
- return err;
- }
-
-